const _ = require('lodash')

const reverse = arr => arr.reverse
const first = arr => arr[0]
const toUpper = s => s.toUpperCase()

const f = _.flowRight(toUpper, first, reverse)
console.log(f(['one', 'two', 'three']))

//需要组合函数时满足结合律的
const f1 = _.flowRight(_.toUpper, _.first, _.reverse)
const f2 = _.flowRight(_.flowRight(_.toUpper, _.first), _.reverse)
const f = _.flowRight(_.toUpper, _.flowRight(_.first, _.reverse))
console.log(f1(['one', 'two', 'three']))
console.log(f2(['one', 'two', 'three']))
console.log(f3(['one', 'two', 'three']))

